classDiagram
    class DatabaseConfig {
        <<Singleton>>
        -MySQLConfig mysql_config
        -RedisConfig redis_config
        +Instance() DatabaseConfig
        +LoadFromFile() bool
        +GetMySQLConfig() MySQLConfig
    }
    
    class MySQLPool {
        <<Singleton>>
        -queue~Connection~ connections
        -mutex mtx
        -condition_variable cv
        +Instance() MySQLPool
        +Initialize() bool
        +GetConnection() Connection*
        +ReturnConnection() void
        +GetStats() PoolStats
    }
    
    class MySQLConnectionGuard {
        <<RAII>>
        -Connection* conn
        -MySQLPool* pool
        +MySQLConnectionGuard(timeout)
        +~MySQLConnectionGuard()
        +operator->() Connection*
        +IsValid() bool
    }
    
    class MySQLORM {
        <<Static>>
        +FindOne() json
        +FindAll() json
        +Insert() int64_t
        +Update() int
        +Delete() int
        +Transaction() bool
    }
    
    DatabaseConfig ..> MySQLPool : 配置
    MySQLPool <.. MySQLConnectionGuard : 使用
    MySQLConnectionGuard <.. MySQLORM : 使用
